<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const arr = [["hello", "bill"], ["hello", "jack"],["world", "foo", "jerry"], ["world", "foo", "peter", "tom"], ["world","bar"]]
    arr.forEach(item => {
        // console.log('item',...new Set(item))
        console.log('item',item)
        item.forEach(item2 => {
            console.log('item2',item2)
        })
    })
    /*请用js实现将一个二维数组转换成树结构，例： [["hello", "bill"], ["hello", "jack"],
        ["world", "foo", "jerry"], ["world", "foo", "peter", "tom"], ["world",
            "bar"]] 转换成：
[
    {
        "id": "01",
        "name": "hello",
        "child": [
            {
                "id": "0101",
                "name": "bill"
            },
            {
                "id": "0102",
                "name": "jack"
            }
        ]
    },
    {
        "id": "02",
        "name": "world",
        "child": [
            {
                "id": "0201",
                "name": "foo",
                "child": [
                    {
                        "id": "020101",
                        "name": "jerry"
                    },
                    {
                        "id": "020102",
                        "name": "peter",
                        "child": [
                            {
                                "id": "02010201",
                                "name": "tom"
                            }
                        ]
                    }
                ]
            },
            {
                "id": "0202",
                "name": "bar"
            }
        ]
    }
]*/
    /*let str = 'abcbac'
    console.log(str)
    let _arr = str.split('a')
    console.log(_arr)
    str = _arr.join('<a>')
    console.log(str)*/
    /*var arr = []
    for (let i = 0; i < 200; i++) {
        arr.push(i)
    }
    //  200个接口  每10个一组,每次调用完一组后再调用下一组
    var total = Math.ceil(arr.length / 10)
    var currIndex = 1
    function getAjax () {
        let _arr = arr.slice((currIndex - 1) * 10, (currIndex - 1) * 10 + 10)
        //   Promise.all(_arr).then(res=>{currIndex++   if(currIndex>total){结束 }else{getAjax()}   })
        setTimeout(() => {
            window.console.log(_arr)
            currIndex++
            if (currIndex > total) {
                alert('结束')
            } else {
                getAjax()
            }
        }, 2000)
    }
    getAjax()
    window.console.log(total)*/
</script>
</body>
</html>
